package com.google.denta.dao;

import java.io.Serializable;

/**
 * @author crash
 *
 * @param <T> class type
 * @param <PK> primary key
 */
public interface Dao<T, PK extends Serializable> {
    /**
     * Create entity in data source.
     * @param entity Entity
     * @return primary key
     */
    PK create(T entity);

    /**
     * Read entity from data source.
     * @param id primary key entity
     * @return entity Entity
     */
    T read(PK id);

    /**
     * Update entity in data source.
     * @param entity Entity
     */
    void update(T entity);

    /**
     * Delete entity from data source.
     * @param id primary key entity
     */
    void delete(PK id);
}
